package org.zht.dormpro.dorm.cacher.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.zht.dormpro.dorm.aop.annotation.GetCache;
import org.zht.dormpro.dorm.cacher.IClassCacher;
import org.zht.dormpro.dorm.mapper.TbClassMapper;
import org.zht.dormpro.dorm.model.TbClass;
import org.zht.dormpro.pub.constant.CacheKey;

import java.util.List;

@Repository
public class ClassCacherImpl implements IClassCacher{
    @Autowired
    private TbClassMapper tbClassMapper;

    @Override
    @GetCache(key = CacheKey.CLASS_LIST_KEY,fieldKey = "#majId")
    public List<TbClass> getAllClassByMajId(String majId){
        List<TbClass> classes = tbClassMapper.getAllClassByMajId(majId);
        return classes;
    }
}
